{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import sympy as sym\n",
    "from sympy.polys import subresultants_qq_zz\n",
    "\n",
    "sym.init_printing()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The Bezout matrix is a special square matrix associated with two polynomials, introduced by Sylvester (1853) and Cayley (1857) and named after Étienne Bézout. Bézoutian may also refer to the determinant of this matrix, which is equal to the resultant of the two polynomials.\n",
    "\n",
    "The entries of Bezout matrix are bilinear functions of coefficients of the given polynomials. The Bezout formulation has gone over different generalizations. The most common one is the Cayley.. Cayley's matrix is given by,"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$ \\left|\n",
    "\\begin{array}{cc} \n",
    "p(x) & q(x)\\\\\n",
    "p(a)& q(a)\n",
    "\\end{array}\n",
    "\\right| = \\Delta(x, a)$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "where $\\Delta(x, a)$ is the determinant."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We have the polynomial:\n",
    "\n",
    "$$ \\delta(x, a) = \\frac{\\Delta(x,a)}{x-a}$$\n",
    "\n",
    "The matrix is then constructed from the coefficients of polynomial $\\alpha$. Each coefficient is viewed as a polynomial of $x_1,..., x_n$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The Bezout matrix is highly related to the Sylvester matrix and the greatest common divisor of polynomials. Unlike in Sylvester's formulation, where the resultant of $p$ and $q$ is the determinant of an $(m + n) \\times (m + n)$ matrix, in the Cayley formulation, the resultant is obtained\n",
    "as the determinant of a $n \\times n$ matrix."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example: Generic example\n",
    "------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "b_3, b_2, b_1, b_0 = sym.symbols(\"b_3, b_2, b_1, b_0\")\n",
    "x = sym.symbols('x')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "b = sym.IndexedBase(\"b\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "p = b_2 * x ** 2 + b_1 * x + b_0\n",
    "q = sym.diff(p, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALAAAAAzBAMAAADFvZ8bAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMA74lUMhDN3SKZu6tEdmbQNlrcAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADvElEQVRYCdWYT0hUURTGvxnnOWOOjVHgLgcXlYtIkYiKSMEEV03goj8LhcgIF04tKshwduWqoahQqQhqYSs35coaor0ucxFIu3alTglJr/v3eN/zvvtycNNdzDvvnO/8vPO8nPl4QA0rOfU4vqvVX4kXhRSH8C6UCd0e8X9gb++ZUDb+9jbOlpyqgd5O7HMq7MUxPKjYK5TtCYAnpl7Be1lU1YstJNsMVPl0YTMFElIABMDeLI5UUD+re0Z0YF5l+a6ZAgkpCIIbC0g0I9ehm1Z1wK+n1I0oJ8tmCSSkIAhOFNG4hgX9LbNVs1uDRfmbWQEJKQg9ivoqBx/UTcmijvhVg3k5m89285xaJKQgBGa6dBUjXx7Jhvr5JXoqm2Be7us6ob8Wl5KQgq3ghbz3szBYajqcBwaveOton1EItWNRbvV9+bflpxCmhgIdgVPBZHdQV0Uu/xUnAXakVpKlRtbAlwKLsszQJxemptmDMzoE2Lt6i62b3UBDGQ1DGMyPIVfAE3gr6VJqnQEODA9fHx7mh0mU0UdQHnAh6hjY6AjteIk9sDIWjq4h0YFryK6mK5kNCVE75uWO/rkAmAsF2OgIguvKuJ9bxouBdaSX8QcN7MCx7y6WAvNyAcdkTn0KId+x0REE9wOfcxVvf6qK9CI2cG6ZnZNF2a7BrIwQWAg52OgIgDM32qaLjcu7yuy5JhbxHjOM2a62pcC8HAYLIQcbHQFwve/7Re/Zc3hryFVwYYlteDfDiKXAvBwGCyEHGx0BsEKwizgV4vYjPsm0Asub4DMWOQ4WS3ZEgJf4OeYrdbnrtYzOy4v8tIGbZUl1RICTD9WPWsL3v5tEFW8FZ57+XhRF1REBtrACqc7Ane2mNvDE+LwNZuZqA5uEiPj/Aesxu9M7pjG702A1Zrf+gkT8K/45TWM2YsfkPChwozOTb7qVb1FjNgJssyAu9CUk2e+BsCtqzEaByXlQ4OLiLbAH0reoMRsBJudBgZOLFuBDt9DqMRsBJudBgRs8WmBgodVjNgJMzoMCN5hVxwtcS2M2AmyzIG50dkUYHBqzEWCbBXGD07PCrpAoAmyzINRjDSaVb4mZFTYLYuXpZFMZwuDEzQqbBdEM6/U4MiXeFDcrbBbEClTJVBlNJd4UNytsFsQFvtfWPqfsintW2CyICzzq+7+kXdGWLOJUCEjIgrjARs09KyQ4aEGMZkcYMyt4Z9iCOGhGKWZWGMrthXGzYns0Qx03KwxpjWFPTa8VYv8Yf61Qy4uQWDB7EfIX8pJJjhEm3bYAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}- 2 b_{0} b_{2} + b_{1}^{2} & b_{1} b_{2}\\\\b_{1} b_{2} & 2 b_{2}^{2}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡             2       ⎤\n",
       "⎢-2⋅b₀⋅b₂ + b₁   b₁⋅b₂⎥\n",
       "⎢                     ⎥\n",
       "⎢                    2⎥\n",
       "⎣    b₁⋅b₂       2⋅b₂ ⎦"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "subresultants_qq_zz.bezout(p, q, x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example: Existence of common roots\n",
    "------------------------------------------\n",
    "\n",
    "Note that if the system has a common root we are expecting the resultant/determinant to equal to zero."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**A commot root exists.**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# example one\n",
    "p = x ** 3 +1\n",
    "q = x + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGkAAABLCAMAAABEOFk1AAAAPFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo1xBWAAAAE3RSTlMAMquZdlQQQOkwRM3d72aJIrtsTy4ynwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAilJREFUWAntmd1igyAMhfF3XbXajvd/14F28UQjcSpebHjTmMD5MEM9XU1mhyM3sY52BBiT2aJ0RxULZDovn1tPyqJBJuHuEKku+q7fuEyNVD3qaVmLqHEdr9vnIk8JmB4k1XmR2wCpe3jJviFhHvDpQZKbWIZIr2G7VoEhMP0QyQ6ku13ftSeRalv4dt1tybsGZyeRnrb3otn4AfpTeBppuKY9pLpp6WjG2wQWNa30HV3XPTPuiCr+jjCvl7+67oJdPt65xdqd61YBzT90P5nWP40egQffZlKRP2yTd+8dsPyoe/c2WAex6do1LdX3ZhJpb+f8vNS91D3egf+zI37jGHmP1s/k7qmOkQTBOlIOAiiLJMUxkhK3jpT+CXhZJOmO8UcMX3WUg0B7P+mOkcRAinIQQFm6pg2eh8RAinIQQFkibXCMJAZSlIMAyjJJdYwkBlKUgwDKEile9z5un7AMF+qOkcbDoikHAZS/bsL3XN0xkhhIUQ4CKEvdM7pjJDGQohwEUBZJumMkMZCiHARQlkmKYyQpZh0pSwEryyQae2KQSEeambqXusc7kHYE74d6xgzqWvfAEgYFg+OYQRVJ3BKuk5Rx3KCKJKcNL5Z1kjKOG9SYJG5QI5JmFisiaWZQo5KYQY1Iuq57M4Ma8Zpm/9KMSeIGNSaJG1SZxCxh4BmhjGMGVSYFxHeXEml369zEv9u9q345rv0Pu2V5P/JXCM4dfjkuS/MN008k8XrG9kMAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}-1 & 0 & 1\\\\0 & 1 & 1\\\\1 & 1 & 0\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡-1  0  1⎤\n",
       "⎢        ⎥\n",
       "⎢0   1  1⎥\n",
       "⎢        ⎥\n",
       "⎣1   1  0⎦"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "subresultants_qq_zz.bezout(p, q, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJZjLNVN0i77urRHZ72Yd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVElEQVQIHWNgEDIxZWBgSGeQmMDAsoCBOYGB+wAD+0cG/gMMvN8Z5BUYeP8xzDdgYP3MMF8BREJEgLLs3xm4NzCwfATpYkpgYGhnkApgYBB+d5QBAPogE3QldevOAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$0$$"
      ],
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "subresultants_qq_zz.bezout(p, q, x).det()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# example two\n",
    "p = x ** 2 - 5 * x + 6\n",
    "q = x ** 2 - 3 * x + 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFYAAAAyBAMAAAA0HTGIAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMA74lUMhB2mUSrZiLNu907M7ajAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABk0lEQVRIDe3Wv0vDQBQH8G+vTamNVEQdHNTiIgiigiDdIlTErYgUBMHqP2BxqaN/gXRRiIPtrkNnB3Gwo7a7iP4B/qC6qFDjlSSae30H7abgLXd5+eTxuAsvwZjzgk7GtNPAQHqxE4rV9CwGO5IttPBts1u7+qciecXm0TOjxYl60IbLMC+0dlOxog7jXmfNU8XGmhlR1lnRq1iUPiZ1FCfECqeqs0aO2NR+Y0+DBVQbL2J7iNj1p9a4xByxoQoir8R6l0aS2A1544i3YdsuDecCZyzz4oa3MhpS9ixWRVw+qxl9isXyjv7dEXfv5UANmoTB8M87GYzy63/r7stv3IclemRm4dbyYrTeR2rXIN54Gx2h9gDo5+3ZFbWjQMlyg6SGZJutZTQ2XmmzMuVzhsubBWNjft9Xa0hyNlF007q92rhu9YwHK2xxtuDRQF+XkRUwNppnbcq2G4f+HX+eh1lx12q9QNtZyC9FVGObfjp/Ph+fOPbWJO+UQ3tazXE+eetnY2eSlzV+8O/Zbv4JuvjX+AKih2yzJjNIMQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}8 & -4\\\\-4 & 2\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡8   -4⎤\n",
       "⎢      ⎥\n",
       "⎣-4  2 ⎦"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "subresultants_qq_zz.bezout(p, q, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJZjLNVN0i77urRHZ72Yd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVElEQVQIHWNgEDIxZWBgSGeQmMDAsoCBOYGB+wAD+0cG/gMMvN8Z5BUYeP8xzDdgYP3MMF8BREJEgLLs3xm4NzCwfATpYkpgYGhnkApgYBB+d5QBAPogE3QldevOAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$0$$"
      ],
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "subresultants_qq_zz.bezout(p, q, x).det()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**A common root does not exist.**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "z = x ** 2 - 7 * x + 12\n",
    "h = x ** 2 - x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACMAAAAOBAMAAABXxbiCAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMquZiWYiRHa7VO+0fdwUAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAmElEQVQYGWNggALnsPLyAs60Mw4wAQaG/v///weIMrD/QghlMjCwMgQyMLxDCBUwMJQwPGZgiEfSycC1gUFfAFWIB6zFXgChk6ECxOb6jiTC+AHEYQ5gYBAyBgEVBgZuBZBQGoiAAeYDQBZ3AowLouWBWhiuMXBOQAj6JzAwsCQwcCMJ3QcKTS4vC0YoYph3gYFB////zwwAF1cfSL3vOa0AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$-72$$"
      ],
      "text/plain": [
       "-72"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "subresultants_qq_zz.bezout(z, h, x).det()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Dixon's Resultant\n",
    "-----------------\n",
    "\n",
    "Dixon (1908) showed how to extend this formulation to $m = 3$ polynomials in $n = 2$ variables."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In a similar manner but this time,\n",
    "\n",
    "$$ \\left|\n",
    "\\begin{array}{cc} \n",
    "p(x, y) & q(x, y) & h(x, y) \\cr\n",
    "p(a, y) & q(a, y) & h(b, y) \\cr\n",
    "p(a, b) & q(a, b) & h(a, b) \\cr\n",
    "\\end{array}\n",
    "\\right| = \\Delta(x, y, \\alpha, \\beta)$$\n",
    "\n",
    "where $\\Delta(x, y, \\alpha, \\beta)$ is the determinant."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Thus, we have the polynomial:\n",
    "\n",
    "$$ \\delta(x,y, \\alpha, \\beta) = \\frac{\\Delta(x, y, \\alpha, \\beta)}{(x-\\alpha)(y - \\beta)}$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sympy.polys.multivariate_resultants import DixonResultant"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example: Generic example of Dixon $(n=2, m=3)$\n",
    "---------------------------------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "a_1, a_2, b_1, b_2, u_1, u_2, u_3 = sym.symbols('a_1, a_2, b_1, b_2, u_1, u_2, u_3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "y = sym.symbols('y')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "p = a_1 * x ** 2 * y ** 2 + a_2 * x ** 2\n",
    "q = b_1 * x ** 2 * y ** 2 + b_2 * y ** 2\n",
    "h = u_1 * x + u_2 * y + u_3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "dixon = DixonResultant(variables=[x, y], polynomials=[p, q, h])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "poly = dixon.get_dixon_polynomial()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAADsAAAAAcBAMAAACXeIZmAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIqvdzbtmMu+JdkSZEFSzbGo9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAdW0lEQVR4Ae1dDYxc11W+413Pen9mvaRqhUQUbyCtFEtQt6kCSShZUleU0FK3IqiUoI4ohBYFZSmtVATUrkiCmoZ2aVFL7JSMaBG165AVlSBUSBklToqDQoaoFSYCeUuFiPhpnahKSYITzs+955z73r3vvXm73l0HP8kz9953fr7znXPvfW9m9tm58+aYPv6DW4X17htH63R9+MGWFqYffmydrtupb4jfdaRs/ZRT3OsNow2MVlG3cdQus1uq1YqbVkpbGibXXvsF6/yrhvM0R1tfJdsHwSPu4S0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atorname{Poly}{\\left( \\left(a_{2} b_{1} u_{1} x + a_{2} b_{1} u_{2} y + a_{2} b_{1} u_{3}\\right) \\alpha_{0}^{3}\\alpha_{1} + \\left(a_{2} b_{1} u_{1} x y + a_{2} b_{1} u_{2} y^{2} + a_{2} b_{1} u_{3} y\\right) \\alpha_{0}^{3} + \\left(a_{1} b_{2} u_{1} y^{2} + a_{2} b_{1} u_{2} x y + a_{2} b_{1} u_{3} x\\right) \\alpha_{0}^{2}\\alpha_{1} + \\left(a_{1} b_{2} u_{1} y^{3} + a_{2} b_{1} u_{2} x y^{2} + a_{2} b_{1} u_{3} x y\\right) \\alpha_{0}^{2} + \\left(a_{1} b_{2} u_{1} x y^{2} + a_{1} b_{2} u_{2} y^{3} + a_{1} b_{2} u_{3} y^{2} + a_{2} b_{2} u_{1} x + a_{2} b_{2} u_{2} y + a_{2} b_{2} u_{3}\\right) \\alpha_{0}\\alpha_{1} + \\left(a_{1} b_{2} u_{1} x y^{3} + a_{1} b_{2} u_{3} y^{3} + a_{2} b_{2} u_{1} x y + a_{2} b_{2} u_{3} y\\right) \\alpha_{0} + \\left(a_{1} b_{2} u_{2} x y^{3} + a_{1} b_{2} u_{3} x y^{2} + a_{2} b_{2} u_{2} x y + a_{2} b_{2} u_{3} x\\right) \\alpha_{1} + a_{1} b_{2} u_{3} x y^{3} + a_{2} b_{2} u_{3} x y, \\alpha_{0}, \\alpha_{1}, domain=\\mathbb{Z}\\left[x, y, a_{1}, a_{2}, b_{1}, b_{2}, u_{1}, u_{2}, u_{3}\\right] \\right)}$$"
      ],
      "text/plain": [
       "Poly((a_2*b_1*u_1*x + a_2*b_1*u_2*y + a_2*b_1*u_3)*alpha0**3*alpha1 + (a_2*b_1\n",
       "*u_1*x*y + a_2*b_1*u_2*y**2 + a_2*b_1*u_3*y)*alpha0**3 + (a_1*b_2*u_1*y**2 + a\n",
       "_2*b_1*u_2*x*y + a_2*b_1*u_3*x)*alpha0**2*alpha1 + (a_1*b_2*u_1*y**3 + a_2*b_1\n",
       "*u_2*x*y**2 + a_2*b_1*u_3*x*y)*alpha0**2 + (a_1*b_2*u_1*x*y**2 + a_1*b_2*u_2*y\n",
       "**3 + a_1*b_2*u_3*y**2 + a_2*b_2*u_1*x + a_2*b_2*u_2*y + a_2*b_2*u_3)*alpha0*a\n",
       "lpha1 + (a_1*b_2*u_1*x*y**3 + a_1*b_2*u_3*y**3 + a_2*b_2*u_1*x*y + a_2*b_2*u_3\n",
       "*y)*alpha0 + (a_1*b_2*u_2*x*y**3 + a_1*b_2*u_3*x*y**2 + a_2*b_2*u_2*x*y + a_2*\n",
       "b_2*u_3*x)*alpha1 + a_1*b_2*u_3*x*y**3 + a_2*b_2*u_3*x*y, alpha0, alpha1, doma\n",
       "in='ZZ[x,y,a_1,a_2,b_1,b_2,u_1,u_2,u_3]')"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "matrix = dixon.get_dixon_matrix(poly)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAn8AAADICAMAAACuwHctAAAAP1BMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADFBd4eAAAAFHRSTlMAMquZdlQQQO0wRIlmzd0i77t8bBwggJIAAAAJcEhZcwAADsQAAA7EAZUrDhsAABikSURBVHgB7Z3pYsI6DoVTtnundJ3h/Z917CR2rEhOjhVloZgfLQjn+EgWBChf3bw92supqZdage0q8NW1XdO8Pc4Xd7luN3WdqVag+fBNd3r4/nur5agV2KUCH7X/dql7nbSrANh/t/P94274LGmt1xgK3n5/vuzbw9Bga85QzzzhAkGw/z7di8Pb17fZsljrNa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UA42S/c/GUFf7YGfQqmGa+gt5fBUf8JNHbdf3r+ITA7wppXs9bblX97e7z1BUxp7MD/Drx4AGQJf37A3ZMpf76twUwnojh25nAWttY7HH8+8L+R7w4kLcGxp3ldVrcugMLJ7PCEPw9u+P7YlD/f1iBz3AfUGWcErfUOx58P37+PvHgAZCmOfXdvnRxDXHRRnz0SXDy4GfjzGNnRYK4M6owzgtZ6xzj/Jnj30H8D3+1AzG9PO6Z4t69POY6jpacTgxHXFfztZzDTLuH9x9XsoyJtBY9mMH3/keLdQ/9Fvttb707GFMdW4LAgnDwuFjXYuxH8pfy509jO4NjwcFuZ8SAwumat9yT8eYf6Ehxbg8N2H04Ww85j/rx1Q/jzHkXey+CoSZKbyowTBXrVWu85+PMe9SU4tub8q4WdKX/euUn584Ai72aQNkl6C8Ox0yOmr1vraZck6xIzmJ5/RVzc/eH84t9D+kvAYUc4tgKHxeDkbtbkJ+HPezeCvxF/7l61XhMR6KrSYF7bWtBa7wn482PhsNwNj/Sv/dbbPjnfb/UeqALk+Y8cMcZ1ZZJ2NxyWw7k84vPZzSApZr2RqUCu/ziuK5O0u+GwHM7lEZ/zbgYzBa9hUoFc/5FB9UatwEoVqP23UmGrLFSB2n9QmeqglSrQ9d/DX04rTVFlawWkCny1Xee+O3C7tBf/l916qRXYqgIfXds1/wcALtA7k4r82QAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}0 & 0 & 0 & a_{2} b_{1} u_{1} & 0 & 0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3}\\\\0 & 0 & a_{2} b_{1} u_{1} & 0 & 0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3} & 0\\\\0 & 0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3} & 0 & a_{1} b_{2} u_{1} & 0 & 0\\\\0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3} & 0 & a_{1} b_{2} u_{1} & 0 & 0 & 0\\\\0 & a_{1} b_{2} u_{1} & 0 & a_{2} b_{2} u_{1} & a_{1} b_{2} u_{2} & a_{1} b_{2} u_{3} & a_{2} b_{2} u_{2} & a_{2} b_{2} u_{3}\\\\a_{1} b_{2} u_{1} & 0 & a_{2} b_{2} u_{1} & 0 & a_{1} b_{2} u_{3} & 0 & a_{2} b_{2} u_{3} & 0\\\\a_{1} b_{2} u_{2} & a_{1} b_{2} u_{3} & a_{2} b_{2} u_{2} & a_{2} b_{2} u_{3} & 0 & 0 & 0 & 0\\\\a_{1} b_{2} u_{3} & 0 & a_{2} b_{2} u_{3} & 0 & 0 & 0 & 0 & 0\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡   0         0         0      a₂⋅b₁⋅u₁     0         0      a₂⋅b₁⋅u₂  a₂⋅b₁⋅u\n",
       "⎢                                                                             \n",
       "⎢   0         0      a₂⋅b₁⋅u₁     0         0      a₂⋅b₁⋅u₂  a₂⋅b₁⋅u₃     0   \n",
       "⎢                                                                             \n",
       "⎢   0         0      a₂⋅b₁⋅u₂  a₂⋅b₁⋅u₃     0      a₁⋅b₂⋅u₁     0         0   \n",
       "⎢                                                                             \n",
       "⎢   0      a₂⋅b₁⋅u₂  a₂⋅b₁⋅u₃     0      a₁⋅b₂⋅u₁     0         0         0   \n",
       "⎢                                                                             \n",
       "⎢   0      a₁⋅b₂⋅u₁     0      a₂⋅b₂⋅u₁  a₁⋅b₂⋅u₂  a₁⋅b₂⋅u₃  a₂⋅b₂⋅u₂  a₂⋅b₂⋅u\n",
       "⎢                                                                             \n",
       "⎢a₁⋅b₂⋅u₁     0      a₂⋅b₂⋅u₁     0      a₁⋅b₂⋅u₃     0      a₂⋅b₂⋅u₃     0   \n",
       "⎢                                                                             \n",
       "⎢a₁⋅b₂⋅u₂  a₁⋅b₂⋅u₃  a₂⋅b₂⋅u₂  a₂⋅b₂⋅u₃     0         0         0         0   \n",
       "⎢                                                                             \n",
       "⎣a₁⋅b₂⋅u₃     0      a₂⋅b₂⋅u₃     0         0         0         0         0   \n",
       "\n",
       "₃⎤\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       "₃⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎥\n",
       " ⎦"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAwcAAAAcBAMAAADGj965AAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIpmJdu8QRM1mu90yVKvMIHo8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJ90lEQVRoBe1ZXWhlVxVe997k5u9m5jpgQQTnkg4yk+I0TudBUWxMHfVBsUot9Qc8agXxYRKQvgkJUiRQ7ERFH/TBUFBkEE21oiK0aX2wL3ZisQpqmYihqKUYLaQWO43rf619c24yCYIvs+Ge8+21v/Wttdc+f9kB4NaafqMAPK4KSia1kD1B6p57qKJTAohXyVDbkube8TTosiXLzQ5wfLXkHNALz4PDHSBVDNfqZoaHc4Cj45kBb4a/Wn9yR1CYzIL2BInV6h5bonMAxH0cHtdDaGbrnkGXLVludoDj+0QrvbmXPCOXZKxxuS5TkgjdwtPNDnD4apU5D8OVrvY/rYsQJrMgweCvhDzR7fyTkYPEEUpxDM3CLJ0YzGqJ6GYHOGgZJd4+MHkeGG4fmT1DtboFy8M5AGjfXsFQsH4KJxe0925dhDCZBQkKO6tCnlhovMTIQXCEUR5Ds7RzLwazWiK62QEOpuQSdRBMngeGG6RRZ6/VLYgezgHA0HwFI5uJZndG53e6CH6zJIvB0co8/WngwDjGKM8WprRqLwZdreS52cH+0Upv7rmnzw/NyVjjcl2mJBHTKDz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Yul+NtgjSdSe6KLW5037RZM+KPEIiJhrhTDSdwyEy9Zi+TVSr25eRVdG9det12qPFCK0uNze5Bc3sMbyglIgduSoHGZ80Vpxd0/mx6cLvBKXa46jdDd9cQbx9tLniftF8aywSxi/gnmn4088NATzR2B7zREO2VrfMyMN5xrpZbBccP3s0sK+uk92CDPyewif2jCXpKTowjjHKs2viX8bc0qaLzw0HGn0brEL2IHFRZichpeMzhmO/xiXSbuagcOxtico+mQiabsjmRcjlsgTw7GavgewKx39rYi6xukYOC74RTq6gXkcrmK5Nn5xxUvgETbNxy6uzbOZNJyXYIL4RGi8nJ4cepP72cZ6CE49tKeKtMcYuATGtQeHIwROFyNR1QzYtQuhqcDmF2acp99bYpvNscdMmoJnSej8MFypyecH8/DpxgF+0wjFKcTbNwmgdH5zoDuFm4d5mQfLt40576XUWk8gbx4PC1fkPstXpFtyoomcs05hYN54vLvjqusktAL+848/s8Vn18+vEQXBMOp9dMxsNx2Dn/Du6Zk1nDxIXJYRTIg6GLgExURgQbrDK3pFa3YLmVYyMZRpfK2iH6ODfwDfa/6YCjdUj6/z+yJ43HMsKNKuyf6P3f6rAfwHLFZ4jfYno2gAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$a_{1}^{2} a_{2}^{4} b_{1}^{2} b_{2}^{4} u_{3}^{4} \\left(a_{1}^{2} b_{1}^{2} u_{3}^{4} + 2 a_{1}^{2} b_{1} b_{2} u_{1}^{2} u_{3}^{2} + a_{1}^{2} b_{2}^{2} u_{1}^{4} + 2 a_{1} a_{2} b_{1}^{2} u_{2}^{2} u_{3}^{2} - 2 a_{1} a_{2} b_{1} b_{2} u_{1}^{2} u_{2}^{2} + a_{2}^{2} b_{1}^{2} u_{2}^{4}\\right)$$"
      ],
      "text/plain": [
       "  2   4   2   4   4 ⎛  2   2   4       2         2   2     2   2   4          \n",
       "a₁ ⋅a₂ ⋅b₁ ⋅b₂ ⋅u₃ ⋅⎝a₁ ⋅b₁ ⋅u₃  + 2⋅a₁ ⋅b₁⋅b₂⋅u₁ ⋅u₃  + a₁ ⋅b₂ ⋅u₁  + 2⋅a₁⋅a₂\n",
       "\n",
       "   2   2   2                   2   2     2   2   4⎞\n",
       "⋅b₁ ⋅u₂ ⋅u₃  - 2⋅a₁⋅a₂⋅b₁⋅b₂⋅u₁ ⋅u₂  + a₂ ⋅b₁ ⋅u₂ ⎠"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix.det().factor()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "Dixon's General Case\n",
    "--------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[Yang et al.](https://rd.springer.com/chapter/10.1007/3-540-63104-6_11) generalized the Dixon resultant method of three polynomials with two variables to the system of $n+1$ polynomials with $n$ variables."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example: Numerical example\n",
    "--------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "p = x + y\n",
    "q = x ** 2 + y ** 3\n",
    "h = x ** 2 + y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "dixon = DixonResultant([p, q, h], (x, y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABBMAAAAcBAMAAADB8eqoAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIqvdzbtmMu+JdkSZEFSzbGo9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKKUlEQVRoBe1Zf4hcVxU+s7Mzs29m3+wQoYiGZqox0oA0mhBsgmSwKdqidik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BgpuRzqjcnUZijB+MIJRuduHQUWa20KPOJApx8lSjdarrDsqNeunI75WuZmPHOnnj13zkex9JkOWNzAj9uq5nO3DSHVNNBfZjWaowU7Ysj3/P/2cfcYV6A10Q6+ix90+eLJro/khLsG237IdN/rX7woUJgfNrd4dNHpj7LpagfH4uprOjclc2Qr8FyoQY4yFrcfXAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\operatorname{Poly}{\\left( -xy^{2}\\alpha_{0} - xy^{2}\\alpha_{1} - xy\\alpha_{0}\\alpha_{1} - xy\\alpha_{1}^{2} - x\\alpha_{0}\\alpha_{1}^{2} + x\\alpha_{0} - y^{2}\\alpha_{0}\\alpha_{1} + y^{2}\\alpha_{1} - y\\alpha_{0}\\alpha_{1}^{2} + y\\alpha_{1}^{2}, x, y, \\alpha_{0}, \\alpha_{1}, domain=\\mathbb{Z} \\right)}$$"
      ],
      "text/plain": [
       "Poly(-x*y**2*alpha0 - x*y**2*alpha1 - x*y*alpha0*alpha1 - x*y*alpha1**2 - x*al\n",
       "pha0*alpha1**2 + x*alpha0 - y**2*alpha0*alpha1 + y**2*alpha1 - y*alpha0*alpha1\n",
       "**2 + y*alpha1**2, x, y, alpha0, alpha1, domain='ZZ')"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly = dixon.get_dixon_polynomial()\n",
    "poly.simplify()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOgAAAB9CAMAAACf3N+6AAAAP1BMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADFBd4eAAAAFHRSTlMAMquZdlQQQO0wRIlmzd0i77t8bBwggJIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAV5SURBVHgB7Z3rdqMwDISdG+02SZPu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afAknALWikw0pvlsrWnwJJwCxotXAnmxK0d16jRZdPpA8rij2gMH0ZUOkPBmOc8Kg2APGCsmozZgm5cnwEFAWEFTxgBMk0LEa06Q8Ga5kAUEVDxiwTYdMnzNJeTK8SwllAUEVD3hKBfpoiSyMlCfDCVDNSMsyzgcsoKQ8GR5zQlmgimoecM6VjaAlpkGkPBkeV0NZYFDKMh6DoCXG78djzWKexvV9MjzOQlkgUOvJsszvDlb5HpQMnwN9e//Vi/aN4gGnQbCH9jILJOXJ8G45lMWfd/BUiuIBZxnnA2iJLIqUJ8MVUHTqLnGkexoTqGIxZxvSD5DhDChrGQ8pmkBZeexID4tmRygLWNH/7DtBsCOd4ckAtscxqMzZUFtBN1TMB0qtaK1ooTtQT91CC6emXSuqbk2hb9SKMoVjHWY2nslF+4KSVxVFXnC2Lusws/HQkc6ykAGsPguqeMGiKC3pMPcfd81fsW3M4kU2s6DdXPTRTiSlZR1mNt6WxYtsPEBZh5mN50AVdQdQ1qZj443nVV9RTd0BlHWY2XgOVFN3AeX8bidHWq7JSaupJ6DLHGntZJlk8N1l47uJlltir6+pJ6DfuQwHliVYh5mNp0C1LyjxAGUdZjaeA1XUPUBZh5mN50AVdQ9Q1pCm45lrNCjq86DYCx6uYLkBcF+ZzfrjxiwkLex3z4PK3A20FXQDRUwQakWT7dhA54dV9If8y78m/ku84/FjAycoRHj8y7/jMfwFp8le3nqX+vcAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}0 & 0 & -1 & 0 & -1\\\\0 & -1 & 0 & -1 & 0\\\\-1 & 0 & 1 & 0 & 0\\\\0 & -1 & 0 & 0 & 1\\\\-1 & 0 & 0 & 1 & 0\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡0   0   -1  0   -1⎤\n",
       "⎢                  ⎥\n",
       "⎢0   -1  0   -1  0 ⎥\n",
       "⎢                  ⎥\n",
       "⎢-1  0   1   0   0 ⎥\n",
       "⎢                  ⎥\n",
       "⎢0   -1  0   0   1 ⎥\n",
       "⎢                  ⎥\n",
       "⎣-1  0   0   1   0 ⎦"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix = dixon.get_dixon_matrix(polynomial=poly)\n",
    "matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJZjLNVN0i77urRHZ72Yd1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVElEQVQIHWNgEDIxZWBgSGeQmMDAsoCBOYGB+wAD+0cG/gMMvN8Z5BUYeP8xzDdgYP3MMF8BREJEgLLs3xm4NzCwfATpYkpgYGhnkApgYBB+d5QBAPogE3QldevOAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$0$$"
      ],
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix.det()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example: Generic example\n",
    "---------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "a, b, c = sym.symbols('a, b, c')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "p_1 = a * x ** 2 + b * x * y + (b + c - a) * x + a * y + 3 * (c - 1)\n",
    "p_2 = 2 * a ** 2 * x ** 2 + 2 * a * b * x * y + a * b * y + b ** 3\n",
    "p_3 = 4 * (a - b) * x + c * (a + b) * y + 4 * a * b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "polynomials = [p_1, p_2, p_3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "dixon = DixonResultant(polynomials, [x, y])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "poly = dixon.get_dixon_polynomial()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAkAAAAOBAMAAAAPuiubAAAALVBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAIpm7MhCriUTv3c12VLgeopIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABOSURBVAgdY2BUMnZgYAhjYH/BwJDKwDCTgWEWA0OeA8O+ABAJBOsCgATHcxCTKwFEKoEIHgUQeYmBUYCBRYGBR4BBqrwoi4Fh37t3rxgAK5QOlzv7snYAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$2$$"
      ],
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "size = len(poly.monoms())\n",
    "size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAACN4AAAAzBAMAAACwUEqdAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMA74lUMhDN3SKZu6tEdmbQNlrcAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAeBklEQVR4Ae1dfYymV1U/M7Pv7szu7Ey1VptKZNyguDVtl4CJSGAHaA2EPzpLEKwNmU2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lO48oMkgTTrzVrkONB5o6KEqZBWK0qQxqbM5vsbgTEUwwNz3kCtSZl4eHE1KUu6ilEHL+nwZXyfPt5oKBaQvi+a9OYqE0G15xmxcNHZtmTl1mJgRTXUd/mZdDqT9mSSO2kLp3IEVAlWPRhDHIZwjEGrnRt7oh0WC/o4A7VSbqQJCnRBerUnoVZJMFxF2iDIg6SBjAHNWuQ4JKaUKUtrFWlsSjfKbH89MDFBz709b2o72MPaOs13gZoMvYsXzlKvIsZxtfO4eO0CFXe+kMmLN1jjetPlSVdwu0BjyvtecJYldMWhvPVFn+07b0ZrHUK7QB08w5ALZ2lYi0V0dQ3rAlnecxhdvMEa16kuT7qC2wUaU973grMsoSsO5a0v+mzfefOiy5wImERgEoGXQQQm583LIIkTFyYReIlEYHLevEQSNZE5icDLIAJvhkuvve5l4MfEhUkEJhG42CPwrmtfg7+gofgjuRe79Im+SQQmEXiJReCarSf/H6zEMu9BUVo+AAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}- 2 a^{4} c - 8 a^{4} + 12 a^{3} b + 2 a^{3} c^{2} + 2 a^{2} b^{2} c - 4 a^{2} b^{2} + 2 a^{2} b c^{2} & - 2 a^{3} b c - 8 a^{3} b + 12 a^{2} b^{2} + 2 a^{2} b c^{2} + 2 a b^{3} c - 4 a b^{3} + 2 a b^{2} c^{2} & - 8 a^{4} b - 4 a^{3} b^{2} + 6 a^{3} c^{2} - 6 a^{3} c - a^{2} b^{3} c + 8 a^{2} b^{3} + 8 a^{2} b^{2} c + 6 a^{2} b c^{2} - 30 a^{2} b c + 24 a^{2} b - a b^{4} c + 4 a b^{4} + 24 a b^{2} c - 24 a b^{2} - 4 b^{5}\\\\- 8 a^{4} b + 4 a^{3} b^{2} + 6 a^{3} c^{2} - 6 a^{3} c - a^{2} b^{3} c + 6 a^{2} b c^{2} - 6 a^{2} b c - a b^{4} c & - 8 a^{3} b^{2} + 4 a^{2} b^{3} + 6 a^{2} b c^{2} - 6 a^{2} b c - a b^{4} c + 6 a b^{2} c^{2} - 6 a b^{2} c - b^{5} c & - 4 a^{3} b^{2} + a^{2} b^{3} c + 8 a^{2} b^{3} + 4 a^{2} b^{2} c - 12 a^{2} b c + 12 a^{2} b - 4 a b^{4} - a b^{3} c^{2} + 12 a b^{2} c - 12 a b^{2} - b^{5} c - b^{4} c^{2}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡          4        4       3        3  2      2  2        2  2      2    2   \n",
       "⎢     - 2⋅a ⋅c - 8⋅a  + 12⋅a ⋅b + 2⋅a ⋅c  + 2⋅a ⋅b ⋅c - 4⋅a ⋅b  + 2⋅a ⋅b⋅c    \n",
       "⎢                                                                             \n",
       "⎢     4        3  2      3  2      3      2  3        2    2      2          4\n",
       "⎣- 8⋅a ⋅b + 4⋅a ⋅b  + 6⋅a ⋅c  - 6⋅a ⋅c - a ⋅b ⋅c + 6⋅a ⋅b⋅c  - 6⋅a ⋅b⋅c - a⋅b \n",
       "\n",
       "            3          3         2  2      2    2        3          3        2\n",
       "       - 2⋅a ⋅b⋅c - 8⋅a ⋅b + 12⋅a ⋅b  + 2⋅a ⋅b⋅c  + 2⋅a⋅b ⋅c - 4⋅a⋅b  + 2⋅a⋅b \n",
       "                                                                              \n",
       "         3  2      2  3      2    2      2          4          2  2        2  \n",
       "⋅c  - 8⋅a ⋅b  + 4⋅a ⋅b  + 6⋅a ⋅b⋅c  - 6⋅a ⋅b⋅c - a⋅b ⋅c + 6⋅a⋅b ⋅c  - 6⋅a⋅b ⋅c\n",
       "\n",
       "  2           4        3  2      3  2      3      2  3        2  3      2  2  \n",
       "⋅c       - 8⋅a ⋅b - 4⋅a ⋅b  + 6⋅a ⋅c  - 6⋅a ⋅c - a ⋅b ⋅c + 8⋅a ⋅b  + 8⋅a ⋅b ⋅c\n",
       "                                                                              \n",
       "    5                        3  2    2  3        2  3      2  2         2     \n",
       " - b ⋅c                 - 4⋅a ⋅b  + a ⋅b ⋅c + 8⋅a ⋅b  + 4⋅a ⋅b ⋅c - 12⋅a ⋅b⋅c \n",
       "\n",
       "      2    2       2           2        4          4         2           2    \n",
       " + 6⋅a ⋅b⋅c  - 30⋅a ⋅b⋅c + 24⋅a ⋅b - a⋅b ⋅c + 4⋅a⋅b  + 24⋅a⋅b ⋅c - 24⋅a⋅b  - 4\n",
       "                                                                              \n",
       "      2          4      3  2         2           2    5      4  2             \n",
       "+ 12⋅a ⋅b - 4⋅a⋅b  - a⋅b ⋅c  + 12⋅a⋅b ⋅c - 12⋅a⋅b  - b ⋅c - b ⋅c              \n",
       "\n",
       "  5⎤\n",
       "⋅b ⎥\n",
       "   ⎥\n",
       "   ⎥\n",
       "   ⎦"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix = dixon.get_dixon_matrix(poly)\n",
    "matrix"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example: \n",
    "--------------------------------------------------------------------------------------------------\n",
    "**From [Dixon resultant’s solution of systems of geodetic polynomial equations](https://rd.springer.com/content/pdf/10.1007%2Fs00190-007-0199-0.pdf)**\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "z = sym.symbols('z')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "f = x ** 2 + y ** 2 - 1 + z * 0\n",
    "g = x ** 2 + z ** 2 - 1 + y * 0\n",
    "h = y ** 2 + z ** 2 - 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "dixon = DixonResultant([f, g, h], [y, z])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "poly = dixon.get_dixon_polynomial()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count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LMfw4MHFB7RpCXE0NmFEzD7AU+KXcGxNTl6Zz+GBw9BAuiiJcTQ2YUDm/2gJ8Wmh8Pw4AGVRzRpCTF0duE8U1ub/aAnxSaHwzGrIEhsu2gJcXTicDZmv22CwFN8j57WOB48KLBom5YQRycO5zNmP44HLwoC6qAlxNFZwMnI7Mc5C0C1j7ZpCXF0FnCATD52Zz+GBw8IH9GkJcTQicD5nNmP4cFDkAC6aAkxdPbhfPDOfgwPHlB5RJOWEENnF85HzX50Dx6CBNRFS4iuswvno2Y/ugcPqjyiTUuIrrMLB5HZq8v2Qyj+2NIzVIFEcH6W2S9UzNTtieCkDquM5ypQ4GT8PihwCpyMK5BxaM+ZM7utyjjMHxfa6JH4OxU2brOOp7LlUoHBI2nMfyalYroVEJa9AAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}0 & 0 & 0 & - 2 x^{2} + 1\\\\0 & 0 & - 2 x^{2} + 1 & 0\\\\0 & - 2 x^{2} + 1 & 0 & 0\\\\- 2 x^{2} + 1 & 0 & 0 & 0\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                                         2    ⎤\n",
       "⎢    0           0           0       - 2⋅x  + 1⎥\n",
       "⎢                                              ⎥\n",
       "⎢                             2                ⎥\n",
       "⎢    0           0       - 2⋅x  + 1      0     ⎥\n",
       "⎢                                              ⎥\n",
       "⎢                 2                            ⎥\n",
       "⎢    0       - 2⋅x  + 1      0           0     ⎥\n",
       "⎢                                              ⎥\n",
       "⎢     2                                        ⎥\n",
       "⎣- 2⋅x  + 1      0           0           0     ⎦"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix = dixon.get_dixon_matrix(poly)\n",
    "matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQsAAAAWBAMAAAAlRKSQAAAAMFBMVEX///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6o+WJb1FhvvQ3Mor+k6yrES1YNXwqvWFbOpfEgS5y3YcP0Jo/DtmuTQMBU8/m284cdZr8NzNUnsdd1TWXwj6L+B4aAAz6jB7ohOXiQJTK6ER4HmdnbiBbUfL7t1AhktCWRqehkzJQuIRgykUzHxgc6iyOJJ3guGyioIjL+OzwOct8xcMKT76pRt36mHejvzGmb9nadlC/h+NaOhwiWy+Vic3fLLpOz1klBFRG4XG73OMg9a2N/3pPPa3Q2HTTJ928HD/of29KdayT891De/gVF7AHQqE55GAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$16 x^{8} - 32 x^{6} + 24 x^{4} - 8 x^{2} + 1$$"
      ],
      "text/plain": [
       "    8       6       4      2    \n",
       "16⋅x  - 32⋅x  + 24⋅x  - 8⋅x  + 1"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix.det()"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [conda env:sympy]",
   "language": "python",
   "name": "conda-env-sympy-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
